import random
import shutil
import string
import tempfile
from pathlib import Path

import pytest


@pytest.fixture(scope='function')
def workdir():
    tempdir = Path(tempfile.mkdtemp())
    yield tempdir
    shutil.rmtree(tempdir)


@pytest.fixture(scope='function')
def input_path(workdir):
    temppath = workdir / 'testdata.example.bin'
    with temppath.open('wb') as f:
        f.write(''.join(random.choices(string.ascii_letters, k=128)).encode())
    yield temppath
    temppath.unlink()


@pytest.fixture(scope='function')
def output_path(workdir):
    yield workdir
